package hu.sulirend.model;

import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;

/**
 * A Subject related to a Teacher is a SubjectOfTeacher object. It means the Teacher 
 * teaches this kind of Subject, she can have Lessons of this Subject. 
 * 
 * @see <code>hu.sulirend.model.Subject</code>
 * @see <code>hu.sulirend.model.Teacher</code>
 *
 * @author <a href="mailto: peter.szilagyi@gmail.com">Peter Szilagyi</a> 
 * @since 2008
 */
@Entity
public class SubjectOfTeacher extends BaseEntity {

	private static final long serialVersionUID = 5123079483021696107L;
	
	private Subject subject;
	private Teacher teacher;
	
	@ManyToOne(optional=false, fetch=FetchType.EAGER, cascade={})
	@JoinColumn(name="SUBJECT_ID", referencedColumnName="id", unique=false, nullable=false, updatable=true, insertable=true)
	public Subject getSubject() {
		return subject;
	}
	public void setSubject(Subject subject) {
		this.subject = subject;
	}
	@ManyToOne(optional=false, fetch=FetchType.EAGER, cascade={})
	@JoinColumn(name="TEACHER_ID", referencedColumnName="id", unique=false, nullable=false, updatable=true, insertable=true)
	public Teacher getTeacher() {
		return teacher;
	}
	public void setTeacher(Teacher teacher) {
		this.teacher = teacher;
	}
	
}
